package Testhandle_db;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;


import handle_db.Canlendar_DB_Connector;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;


import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import entities.Calendar;


public class Canlendar_DB_ConnectorTest {
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		System.out.println("Before class");
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		System.out.println("After class");
	}

	@Before
	public void setUp() throws Exception {
		System.out.println("Before");
	}
	@Test
	public void testAdd(){
		java.sql.Date d=new java.sql.Date(new Date().getTime());
		Calendar c=new Calendar();
		c.setDate(d);
		c.setMy_arrangement("test");
		c.setUser_number(1);
		
		Canlendar_DB_Connector db=new Canlendar_DB_Connector();
		db.add(c);
		
		ArrayList<Calendar> a=db.get_my_Canlendar(1);
		assertThat(a.get(0).equals(c),is(true));
	}
	@Test
	public void testExecuteUpdate(){
		
	}
	@After
	public void tearDown() throws Exception {
		System.out.println("After");
	}
}
